package _021_10_4

func reverseStr(s string, k int) string {
	n := len(s)
	result := ""
	if n == 0 || n == 1 {
		return result
	}

	if k > n {
		for i := 0; i < n; i++ {
			result += string(s[n-1-i])
		}
		return result
	}

	for i := 0; i < k; i++ {
		result += string(s[k-i-1])
	}
	for i := k; i < len(s); i++ {
		result += string(s[i])
	}
	return result
}
